home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / T / TextImporter1.1.cpt / TextImporter1.1 / card_3848.txt < prev    next >
Text File  |  1987-09-12  |  8KB  |  247 lines

  1. -- card: 3848 from stack: in.1
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 2736
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on openCard
  8.   hide menuBar
  9.   hide background field "Script"
  10.   put empty into background field "Import Text"
  11.   put untitled into background field "fname"
  12.   put empty into temp
  13.   hide background field "SaveDialogBox"
  14.   hide background field "TextFileName"
  15.   hide background button "OK"
  16.   hide background button "Okay"
  17.   hide background button "Cancel"
  18.   hide background field "About..."
  19.   hide background button "Script"
  20.   hide background button "RemoveScript"
  21.   Set textStyle of background field "Import Text" to plain
  22.   Set textFont of background field "Import Text" to Monaco
  23.   Set textSize of background field "Import Text" to 9
  24. end openCard
  25.  
  26. on idle
  27.   put the long date into field "Date"
  28.   put the time into field "Time"
  29.   pass idle
  30. end idle
  31.  
  32.  
  33.  
  34.  
  35. -- part contents for background part 15
  36. ----- text -----
  37. Friday, September 11, 1987
  38.  
  39. -- part contents for background part 16
  40. ----- text -----
  41. 11:09 PM
  42.  
  43. -- part contents for background part 19
  44. ----- text -----
  45.               HyperCard Text File Importer V1.1
  46.  
  47. A simple stack with text file Open, Save, and Save as... & Print capabilities. A New or Save as... text file will be saved using the file name & path entered unless changed.
  48.         I.E. Hard Disk:Document folder:text file
  49.  
  50. Should be used only with small text files up to 16,384 bytes.  Larger files will be opened but the end of the file will be truncated and only the displayed file will be saved.  Thought this stack would be useful to those people, like me, who don't have a HyperTalk manual yet and wish to look at other's scripts to get ideas.  Other notes in the script report.
  51.  
  52. Click the Script button to clear the text window and show the entire stack script. Click on "Remove Script Report" below to permanently remove the script text & button to compact the script size by about 4K.
  53.                            Have Fun!
  54.                         Dick Van Hooft
  55.                         CS: 71310,2130
  56.                        GEnie: D.VANHOOFT
  57. 9/11/87             -Remove Script Report-
  58.  
  59. -- part contents for background part 21
  60. ----- text -----
  61.  
  62. Enter file name & path to save text file
  63.  
  64. -- part contents for background part 28
  65. ----- text -----
  66. SCRIPTS FOR STACK: Importer V1.1 - Dick Van Hooft - 9/11/87
  67. Script Report courtesy of "Script Report by Eric Alderman"
  68.  
  69. Notes - Uses XCFN resource Get FileName() for Open.
  70. Shortcuts for selecting menubar (option-spacebar toggles)
  71.      click on left side of file name header to show menubar
  72.      ckick on right side of file name header to hide menubar
  73.  
  74.  
  75. ** STACK SCRIPT ************************************
  76.  
  77. ** BACKGROUND #1 ***********************************
  78.  
  79. ** BKGND #1, BUTTON #1: Open... ********************
  80. on mouseUp
  81.   Get FileName("TEXT")
  82.   if it is empty then
  83.     exit mouseUp
  84.   else
  85.     put it into temp
  86.     put it into background field "fname"
  87.   end if
  88.   open file temp
  89.   read from file temp for 16384
  90.   put it into infile
  91.   if it is empty
  92.   then close file temp
  93.   close file temp
  94.   put infile into background field "Import Text"
  95. end mouseUp
  96.  
  97. ** BKGND #1, BUTTON #2: New ************************************
  98. on mouseUp
  99.   put empty into background field "fname"
  100.   put empty into background field "Import Text"
  101. end mouseUp
  102.  
  103. ** BKGND #1, BUTTON #3: Save ************************************
  104. on mouseUp
  105.   if background field "fname" is empty then
  106.     put empty into background field "TextFileName"
  107.     show background field "SaveDialogBox"
  108.     show background field "TextFileName"
  109.     show background button "OK"
  110.     show background button "Cancel"
  111.   else
  112.     put background field "fname" into save
  113.     open file save
  114.     write background field "Import Text" to file save
  115.     close file save
  116.   end if
  117. end mouseUp 
  118. ** BKGND #1, BUTTON #4: Print ************************************
  119. on mouseUp
  120.   doMenu Print Report...
  121. end mouseUp
  122.  
  123. ** BKGND #1, BUTTON #5: Home ************************************
  124. on mouseUp
  125.   put empty into background field "Import Text"
  126.   doMenu Compact Stack
  127.   go home
  128. end mouseUp
  129.  
  130. ** BKGND #1, BUTTON #6: Find... ************************************
  131. on mouseUp
  132.   doMenu Find...
  133. end mouseUp
  134.  
  135. ** BKGND #1, BUTTON #7: About ************************************
  136. on mouseUp
  137.   show background field "About..."
  138.   show background button "Okay"
  139.   if background field "Script" is empty then
  140.     exit mouseUp
  141.   else
  142.     show background button "Script"
  143.     show background button "RemoveScript"
  144.   end if
  145. end mouseUp
  146.  
  147. ** BKGND #1, BUTTON #8: Okay ************************************
  148. on mouseUp
  149.   hide background button "Okay"
  150.   hide background button "Script"
  151.   hide background button "RemoveScript"
  152.   hide background field "About..."
  153. end mouseUp
  154.  
  155. ** BKGND #1, BUTTON #9: OK ************************************
  156. on mouseUp
  157.   if background field "TextFileName" is empty then
  158.     exit mouseUp
  159.   end if
  160.   put background field "TextFileName" into save
  161.   open file save
  162.   write background field "Import Text" to file save
  163.   close file save
  164.   hide background button "OK"
  165.   hide background button "Cancel"
  166.   hide background field "TextFileName"
  167.   hide background field "SaveDialogBox"
  168.   put empty into background field "TextFileName"
  169. end mouseUp
  170.  
  171.  
  172. ** BKGND #1, BUTTON #10: Cancel ************************************
  173. on mouseUp
  174.   hide background button "OK"
  175.   hide background button "Cancel"
  176.   hide background field "TextFileName"
  177.   hide background field "SaveDialogBox"
  178.   put empty into background field "TextFileName"
  179. end mouseUp
  180.  
  181. ** BKGND #1, BUTTON #11: Script ************************************
  182. on mouseUp
  183.   put empty into background field "Import Text"
  184.   put background field "Script" into background field "Import Text"
  185.   hide background button "Okay"
  186.   hide background button "Script"
  187.   hide background button "RemoveScript"
  188.   hide background field "About..."
  189. end mouseUp
  190.  
  191. ** BKGND #1, BUTTON #12: Save as... ************************************
  192. on mouseUp
  193.   if background field "fname" is empty then
  194.     put empty into background field "TextFileName"
  195.   else
  196.     put background field "fname" into background field "TextFileName"
  197.   end if
  198.   show background field "SaveDialogBox"
  199.   show background field "TextFileName"
  200.   show background button "OK"
  201.   show background button "Cancel"
  202. end mouseUp
  203.  
  204. ** BKGND #1, BUTTON #13: ShowMenuBar ************************************
  205. on mouseUp
  206.   show menuBar
  207. end mouseUp
  208.  
  209. ** BKGND #1, BUTTON #14 ************************************
  210. on mouseUp
  211.   hide menuBar
  212. end mouseUp
  213.  
  214. ** BKGND #1, BUTTON #15: RemoveScript ************************************
  215. on mouseUp
  216.   put empty into background field "Script"
  217. end mouseUp
  218.  
  219. ** CARD #1 ************************************
  220. on openCard
  221.   hide menuBar
  222.   hide background field "Script"
  223.   put empty into background field "Import Text"
  224.   put empty into background field "fname"
  225.   put empty into temp
  226.   hide background field "SaveDialogBox"
  227.   hide background field "TextFileName"
  228.   hide background button "OK"
  229.   hide background button "Okay"
  230.   hide background button "Cancel"
  231.   hide background field "About..."
  232.   hide background button "Script"
  233.   hide background button "RemoveScript"
  234.   Set textStyle of background field "Import Text" to plain
  235.   Set textFont of background field "Import Text" to Monaco
  236.   Set textSize of background field "Import Text" to 9
  237. end openCard
  238.  
  239. on idle
  240.   put the long date into field "Date"
  241.   put the time into field "Time"
  242.   pass idle
  243. end idle
  244.  
  245. -- part contents for background part 29
  246. ----- text -----
  247. untitled